package com.biz.primus.ms.commodity.dao.po;


import com.biz.primus.base.enums.commodity.IStatus;
import com.biz.primus.commodity.vo.backend.IApartTagVo;
import com.biz.primus.ms.base.jpa.po.BaseEntity;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 商品列表随标(展示在商品列表项之下的商品标签)
 *
 * @author david-liu
 * @date 2016年12月22日
 * @reviewer
 * @see
 */
@Data
@Entity
@Table(name = "pro_product_apart_tag")
public class ApartTag extends BaseEntity {

    private static final long serialVersionUID = 3844899741783875988L;

    /**
     * 随标名称
     */
    @Column(nullable = false)
    private String name;

    /**
     * logo
     */
    @Column(nullable = false)
    private String logo;

    /**
     * 顺序
     */
    @Column
    private Integer idx;

    /**
     * 描述
     */
    @Column
    private String description;

    /**
     * 删除标识(true: 已删除, false: 未删除)
     */
    @Column
    private Boolean deleteFlag = Boolean.FALSE;

    /**
     * 状态
     */
    @Column
    @Convert(converter = IStatus.Converter.class)
    private IStatus status;

    public void form(IApartTagVo iApartTagVo){
        this.setName(iApartTagVo.getName());
        this.setIdx(iApartTagVo.getIdx());
        this.setStatus(iApartTagVo.getStatus());
        this.setDescription(iApartTagVo.getDescription());
        this.setLogo(iApartTagVo.getLogo());
    }
}
